package phantri.uit.menunhahang;

import org.kobjects.base64.Base64;
import org.ksoap2.serialization.SoapObject;

import phantri.uit.menunhahang.MenuCalculate;

;

public class DouongObj extends AbstractModel {

	private static final String DOUONG_ID = "ID_DU";
	private static final String DOUONG_NAME = "Ten_DU";
	private static final String DOUONG_DESCRIPTION = "Mota_DU";
	private static final String DOUONG_PRICE = "Gia_DU";
	private static final String DOUONG_INFO = "GioiThieu_DU";
	private static final String DOUONG_ICON = "Hinh_DU";

	private String DoUong_Ten;
	private String DoUong_Mota;
	private String DoUong_Gia;
	private String DoUong_Gioithieu;
	private byte[] DoUong_Hinh;
	private int DoUong_Soluong;

	public void setName(String ten) {
		DoUong_Ten = ten;
	}

	public String getName() {
		return DoUong_Ten;
	}

	public void setDescription(String mota) {
		DoUong_Mota = mota;
	}

	public String getDescription() {
		return DoUong_Mota;
	}

	public void setPrice(String gia) {
		DoUong_Gia = gia;
	}

	public String getPrice() {
		return DoUong_Gia;
	}

	public void setInfo(String gioithieu) {
		DoUong_Gioithieu = gioithieu;
	}

	public String getInfo() {
		return DoUong_Gioithieu;
	}

	public void setIcon(byte[] icon) {
		DoUong_Hinh = icon;
	}

	public byte[] getIcon() {
		return DoUong_Hinh;
	}

	public int getSoluong() {
		return DoUong_Soluong;
	}

	public void setSoluong(int soluong) {
		this.DoUong_Soluong = soluong;
	}

	public void parse(Object obj) throws ClassCastException, RuntimeException {
		if (obj == null) {
			return;
		}

		SoapObject sobj = (SoapObject) obj;
		this.id = MenuCalculate
				.anyTypeToEmptyString(sobj.getProperty(DOUONG_ID));
		this.DoUong_Ten = MenuCalculate.anyTypeToEmptyString(sobj
				.getProperty(DOUONG_NAME));
		this.DoUong_Mota = MenuCalculate.anyTypeToEmptyString(sobj
				.getProperty(DOUONG_DESCRIPTION));
		this.DoUong_Gia = MenuCalculate.anyTypeToEmptyString(sobj
				.getProperty(DOUONG_PRICE));
		this.DoUong_Gioithieu = MenuCalculate.anyTypeToEmptyString(sobj
				.getProperty(DOUONG_INFO));
		try {
			String temp = sobj.getProperty(DOUONG_ICON).toString();
			if (temp != "") {
				this.DoUong_Hinh = Base64.decode(temp);
			}

		} catch (Exception e) {
			e.printStackTrace();
			this.DoUong_Hinh = null;
		}
	}
}
